﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;

namespace BAL
{
    public partial class Main3 : Form
    {
        private LoginService.BarcodeJudgeServices bjs = new BAL.LoginService.BarcodeJudgeServices();
        private string ID;
        
        public Main3()
        {
            InitializeComponent();
        }

        public Main3(string _ID)
        {
            InitializeComponent();
            this.ID = _ID;
        }

        public void SetButtonValue()
        {
            btnDeliveryMain.Enabled = false;
        }

         //快速出库
        private void btnAbanINStock_Click(object sender, EventArgs e)
        {
            DeliveryMain del = new DeliveryMain(this.ID);
            del.Show();
            this.Hide();
        }

        private void Main3_Load(object sender, EventArgs e)
        {
            label1.Text = Program.user;
            SetButtonValue();
            string result=  bjs.GetPDAAuthority(this.ID);
            string[]  ids =  result.Split(',');
            for(int i = 0; i<ids.Count();i++)
            {
               
                if(ids[i].ToString()=="FastOutStock")
                {
                    btnDeliveryMain.Enabled=true;
                }
            }            

        }
        //返回
        private void button12_Click(object sender, EventArgs e)
        {
            Login iw = new Login();
            iw.Show();
            this.Hide();
        }
        //退出
        private void button11_Click(object sender, EventArgs e)
        {
            Application.Exit();
            //用户存储文件里
            string location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.ToString());
            string path = location + "\\Machines.txt";

            FileStream stream = File.Open(path, FileMode.OpenOrCreate, FileAccess.Write);
            stream.Seek(0, SeekOrigin.Begin);
            stream.SetLength(0);
            stream.Close();
        }
        //上一页
        private void bt_next_Click(object sender, EventArgs e)
        {
            Main2 iw = new Main2(this.ID);
            iw.Show();
            this.Hide();

        }

      
    }
}